//Accepted 
#include <cstdio>
char c[100001];
int sum[10], n, d, i, j, p;

bool read(){
	scanf("%d%d\n", &n, &d);
	if(n==0&&d==0)return 0;
	scanf("%s", c);
	return 1;
}
void process(){
	p=n-d;
	for(i=0;i<10;++i)sum[i]=0;
	for(i=0;i<d+1;++i)sum[c[i]-'0']++;
	i=0;
	while(p>0){
		--p;
		for(j=9;sum[j]==0;--j);
		printf("%d",j);
		while(c[i]!=(j+'0')){
			--sum[c[i]-'0'];
			++i;
		}
		--sum[c[i]-'0'];
		++i;
		if(c[n-p])++sum[c[n-p]-'0'];
	}
	printf("\n");
}

int main(){
	//freopen("in.txt", "r", stdin);
	while(read())process();
	return 0;
}
